<template>
  <div>
    <iframe @load="iframeLoad"  :src="src" scrolling="no" frameborder="0" style="width:100%"></iframe>
    <!-- <iframe :src="src" scrolling="no" frameborder="0"></iframe> -->
  </div>
</template>
<script>
export default {
  data() {
    return { src: "" };
  },
  created(){
  
    this.src = this.$route.query.url+'&sid='+sessionStorage.getItem('sid');
  },
  watch: {
    $route:'createFrameSrc',
  },
  methods: {
    iframeLoad(e) {
      const frameDoc = e.target.contentWindow.document;

      // let scaleNum = document.body.style.transform.match(/[\d\.]+/)[0];
      // if(scaleNum<0){
      //   // frameDoc.body.style.minWidth = '1100px';
      //   frameDoc.documentElement.style.height = 'auto';
      //   frameDoc.body.style.transform = `scale(${1/scaleNum})`;
      //   frameDoc.body.style.transformOrigin = '0 0';
      // }

      // e.target.style.height = frameDoc.documentElement.scrollHeight + "px";
      // e.target.style.minWidth = frameDoc.documentElement.scrollWidth + 'px';
      document.body.scrollIntoView();
    },
    createFrameSrc(){
      this.src = this.$route.query.url+'&sid='+sessionStorage.getItem('sid');
    //   this.src = this.$route.query.url;
 
    }
  },
};
</script>
<style lang="scss" scoped>
div{
  // overflow-x: auto;
  // overflow-y: hidden;
  overflow: hidden;
  position: relative;
  transform: none;
}
iframe {
//   width: calc(100% - 220px);
  width: 100%;
  // height: 900px;
  // min-height: cale(100vh - 80px);
  min-height: calc(100vh - 130px);
  // max-height: calc(100vh + 10px);
  overflow: auto;
  overflow-y: auto;
}
</style>